import { shallowRef } from 'vue'

import { getVIPRule } from './api'
import { catchFn } from '@/libs/common'

/** 会员成长规则列表 */
const list = shallowRef<
  {
    icon: string
    title: string
    description: string
  }[]
>([])

export { list }

/**
 * 更新会员成长规则
 */
const updateVIPRule = () =>
  catchFn(async () => {
    const { data } = await getVIPRule()

    list.value = data
  })

export { updateVIPRule }
